<template>
  <div>
    <el-container class="common-layout">
      <Sidebar :patients="patients" />
      <el-container>
        <el-header>记得按时吃饭🍕</el-header>
        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
import Sidebar from "../../components/Sidebar.vue";
import { getPatients } from "../../api/patient";

const patients = ref([]);

const fetchPatients = async () => {
  try {
    const response = await getPatients();
    patients.value = response.data;
  } catch (error) {
    console.error("Error fetching patients:", error);
  }
};

onMounted(() => {
  fetchPatients();
});


</script>

<style scoped>
.common-layout {
  height: 100vh;
}

.el-header {
  background-color: #f5f5f5;
  padding: 10px;
  text-align: center;
  font-size: 20px;
}
</style>
